﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using jSLApp.Client.MainService;
using jSLCore.Client.Presentation.BaseControl;
using Telerik.Windows.Controls;

namespace jSLApp.Client.Forms
{
    public partial class NewFilm : DialogControl
    {
        public NewFilm()
        {
            InitializeComponent();
        }

        public override void OkClicked()
        {
            DoWork("Создание фильма",(sender, args) =>
                                         {
                                             args.Result = Communication.Proxy.CreateNewFilm(args.String);
                                         },(o, eventArgs) =>
                                               {
                                                   var film = (Film)eventArgs.Result;

                                                   InvokeDataSelected(film.id);
                                               },nameTxt.Value);
        }


        #region dialog
        public override bool IsStandartOkCancelEnabled
        {
            get { return true; }
        }

        public override object OkContent
        {
            get { return "Создать"; }
        }

        public override bool AutoSize
        {
            get { return true; }
        }
        
        public override Control GetControlForInitialFocus()
        {
            return nameTxt;
        }
        #endregion
        
      
    }
}
